home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
mint
/
lib
/
mntlib44.zoo
/
mntlib
/
sprintf.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-12
|
740b
|
45 lines
#include <stdarg.h>
#include <stdio.h>
#include <limits.h>
#include "lib.h"
static int sputc __PROTO((int ch, FILE *fp));
static int
sputc (ch, fp)
int ch;
FILE *fp;
{
char **bufp = (char **) fp;
*(*bufp)++ = ch;
return ch;
}
#ifdef __STDC__
int sprintf(char *buf, const char *fmt, ...)
#else
int sprintf(buf, fmt)
char *buf;
const char *fmt;
#endif
{
register int n;
va_list argp;
va_start(argp, fmt);
n = _doprnt(sputc, (FILE *) &buf, fmt, argp);
*buf = '\0'; /* always tie of the string */
return(n);
}
int vsprintf(buf, fmt, args)
char *buf;
const char *fmt;
va_list args;
{
register int n;
n = _doprnt(sputc, (FILE *) &buf, fmt, args);
*buf = '\0'; /* always tie of the string */
return(n);
}